Skip to content

Added MRP for example#14

Merged
confunguido merged 3 commits intowtk-impl-abc-mvpfrom
gce-abc-mrp-example
Feb 26, 2026
Merged

Added MRP for example#14
confunguido merged 3 commits intowtk-impl-abc-mvpfrom
gce-abc-mrp-example

Conversation

@confunguido
Copy link
Copy Markdown
Collaborator

No description provided.

Copy link
Copy Markdown
Collaborator

@KOVALW KOVALW left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some project file management comments and a discussion on whether or not and how to allow implementation of kwargs for .run()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file should be placed at packages/example_model/src/example_model/calibrate.py so that it can be run using the command uv run python -m example_model.calibrate

)

def run(self):
def run(self, **kwargs: Any):
Copy link
Copy Markdown
Collaborator

@KOVALW KOVALW Feb 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If kwargs are being passed to run (requiring all users to add kwargs to their particles_to_params functions), then they should also be passed to the outputs_to_distance function to allow for adding in runtime changes.

We would also need to flag if any members of kwargs are properties of the sampler, since a user may attempt to set those using run. We don't overwrite any sampler properties from the kwargs of .run(), so we should at least for now throw an error that you cannot pass sampler properties here.

For example, I could easily see someone writing

sampler.run(tolerance_values=[10,5,1])

if run() accepts **kwargs, but we don't have any feature that overwrites experiment level parameters from .run(), so this might lead someone to have unexpected results. In order to accept **kwargs here, I would say we need to choose one of two options:

  1. Override sampler properties if they are a match in kwargs
  2. Throw an error that a key word argument matches a sampler property and abort the run

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For now I've added a suggested commit that goes with option 2.

seed=None, # Propagation of seed must be SeedSequence not int for proper pseudorandom draws
)

sampler.run(base_inputs=default_inputs)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't love this syntax for the reasons I describe in reference to the sampler kwargs implementation. These could also be declared within particles to params instead of called externally

##===================================#
# Print IQR of param1 in the posterior particles
posterior_particles = sampler.get_posterior_particles()
p_values = [p.state["p"] for p in posterior_particles.all_particles]
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flagging that it would be nice to have convenience functions for something like posterior_particles.p that would call a property for the distribution of parameter values in a particle population

@KOVALW KOVALW force-pushed the gce-abc-mrp-example branch from f274c95 to 378f79f Compare February 25, 2026 22:53
@KOVALW KOVALW self-requested a review February 25, 2026 23:05
Copy link
Copy Markdown
Collaborator

@KOVALW KOVALW left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With my suggested changes I would say that this is good to merge, just covering a couple blind spots with kwargs and rebased to the changes on my branch

@confunguido confunguido merged commit 86268f9 into wtk-impl-abc-mvp Feb 26, 2026
2 checks passed
KOVALW added a commit that referenced this pull request Feb 26, 2026
* abcsampler example with binom model using mrp

* wtk suggested edits

* fix particle state call for rebase

---------

Co-authored-by: KOVALW <AD71@cdc.gov>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants